# 带着二哈去旅行丶:ZZQ
# 生成时间：2021/12/6 下午10:11

import matplotlib.pyplot as plt
import csv
from datetime import datetime

filename = 'data/sitka_weather_2018_simple.csv'
with open(filename) as f:
    reader = csv.reader(f)
    header_row = next(reader)

    for index, column_header in enumerate(header_row):
        print(index, column_header)

    dates, prcps = [], []
    for row in reader:
        current_date = datetime.strptime(row[2], '%Y-%m-%d')
        prcp = float(row[3])
        dates.append(current_date)
        prcps.append(prcp)

plt.style.use('Solarize_Light2')
fig, ax = plt.subplots(figsize=(10,6), dpi=128)
ax.plot(dates, prcps, c='green')
ax.set_title('降水量', fontsize=20)
ax.set_xlabel('', fontsize=16)
ax.set_ylabel('毫升', fontsize=16)
fig.autofmt_xdate()
ax.tick_params(axis='both', which='major', labelsize=16)
plt.show()

